
<div class="sign-con w1200">
    <img width="441" height="301" src="<?php echo Url::base(); ?>uploads/<?php echo $data[0]['img'];?>" class="sign-contu f-l" />
    <div class="sign-ipt f-l">
        <p>用户名</p>
        <input type="text" id="phone" placeholder="手机号" />
        <p>密码</p>
        <input type="password" id="password" placeholder="密码" /><br />
        <button class="slig-btn" type="button" onclick="login()">登录</button>
        <p>没有账号？请<a href="<?php echo Url::base(); ?>index.php/reg/regUser">注册</a><a href="<?php echo Url::base(); ?>index.php/user/forget" class="wj">忘记密码？</a></p>
        <div class="sign-qx">
            <a href="#" class="f-r"><img src="<?php echo Url::base(); ?>images/sign-xinlan.gif" /></a>
            <a href="#" class="qq f-r"><img src="<?php echo Url::base(); ?>images/sign-qq.gif" /></a>
            <div style="clear:both;"></div>
        </div>
    </div>
    <div style="clear:both;"></div>
</div>

<script>
    var redirect = null;
    <?php if(isset($_REQUEST['url'])){
        echo "redirect ='". $_REQUEST['url']."';";
    }?>

    var url = '<?php echo Url::base(); ?>';
    function login(){

        if($('#phone').val() == ""||$("#password").val()==""){
            alert("登录信息填写完整")
            return
        }
        $.ajax({

            type: 'post',

            url:  url+'index.php/login/userlogin',

            data: {phone:$('#phone').val(),password:$("#password").val()} ,

            success: function(data){
                console.log(data)
                if(data.status){
                    if(redirect == null){
                        window.location.href = '<?php echo Url::base(); ?>index.php/user/index'
                    }
                }else{
                    alert(data.msg)
                }
            },

            dataType: 'json'

        });
    }
</script>